#ifndef __PHONEBOOK__

#define __PHONEBOOK__

#include<map>
#include<string>
#include<set>
#include<iostream>

struct differentLess {
	bool operator() (std::multimap<std::string, std::string>::iterator const &, std::multimap<std::string, std::string>::iterator const &) const;
};

class PhoneBook {
	std::multimap<std::string, std::string> firstByLast;
	std::multiset<std::multimap<std::string, std::string>::iterator, differentLess> lastByFirst;
	
	public:
		
	PhoneBook();
	~PhoneBook();
	
	friend std::istream & operator>> (std::istream &, PhoneBook &);
	
	void add(std::string const &, std::string const &);	
	void remove(std::string const &, std::string const &);
	
	void printByFirst(std::ostream &);
	void printByLast(std::ostream &);
};

#endif
